<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@page import="com.lavegue.util.MyBeanFactory"%>
<%@page import="com.lavegue.service.UserInfoService"%>
<%@page import="com.lavegue.model.UserInfo"%>
<%@page import="com.lavegue.model.SysMsg"%>
<%@page import="com.lavegue.service.SysMessageService"%>
<%@taglib prefix="s" uri="/struts-tags"%>
<%
Object u = session.getAttribute("userObject");
int sysMsgCnt = 0;
if (u != null) {
	UserInfoService us = (UserInfoService)MyBeanFactory.getBean("userInfoService");
	SysMessageService ss =  (SysMessageService)MyBeanFactory.getBean("sysMessageService");
	List<SysMsg> list =   ss.findAll();
	for(SysMsg sm: list) {
		if (sm.getUserInfo() == null && sm.getStatus() ==0) {
			sysMsgCnt++;
		}
	}
	
	UserInfo uu = us.findById(((UserInfo)u).getId());
	for(SysMsg sm: uu.getSysmsgs()) {
		if(sm.getStatus() ==0) {
			sysMsgCnt++;
		}
	}
}
request.setAttribute("sysMsgCnt", sysMsgCnt);
int logined = 0;
if (session.getAttribute("userObject") != null) {
	logined = 1;
}
%>
<script type="text/javascript">
var logined = "<%=logined%>";
function serchMsg(pageNo)
{
if(pageNo!=0)
{
 document.getElementById("sefrm").action = "mobanListAction!findMsg.action?pageNo=" +pageNo;
}
  document.getElementById("sefrm").submit();
}

function changeContent2(t, v) {
	var f = document.getElementById("frame_content");
	var params = "";
	if (t==0) {
		params= "typeId=" + v;
	} else {
		params= "groupId=" + v;
	}
	if (f == null) {
		if (logined == "0") {
			window.location.href = "indexAction!notLoginIndex.action?" + params;
		} else {
			window.location.href = "loginAction!login.action?" + params;
		}
		
	} else {
		if (t == 0) {
			document.getElementById("frame_content").contentWindow.location.href= "indexAction!findByTypeAndGroup.action?typeId=" + v;
		} else {
				document.getElementById("frame_content").contentWindow.location.href= "indexAction!findByTypeAndGroup.action?groupId=" + v;
		}
	}
	
}

function searchMsg() {
	var f = document.getElementById("frame_content");
	var sform = document.getElementById("sefrm");
	if (f == null) {
		if (logined == "0") {
			sform.action = "indexAction!notLoginIndex.action";
		} else {
			sform.action = "loginAction!login.action";
		}
		sform.target= "";
		sform.submit();
	} else {
		sform.submit();
	}
}

function showSysMsg() {
	var f = document.getElementById("frame_content");
	if (f != null) {
		f.src = "sysMsgAction!toEnterSysMsgList.action";
	} else {
		window.location.href = "loginAction!login.action?showMsg=1";
	}
}
</script>
<link href="manage/manage.css" rel="stylesheet" type="text/css">
<div id="top">
  <div id="topz1" style="text-align: left;">
  <div class="topl1" style="margin-left: 200px;"></div>
  <div class="topr1" style="position:relative;text-align: center;padding-left: 200px;"  >
  <ul style="z-index:1;position: absolute;width: 600px;">
  		<li>
  		<s:if test="#session.userObject !=null">
  			欢迎，${session.userObject.userName} 
  			<s:if test="#session.userObject.type==1">
  				 (VIP会员) 
  			</s:if>
  			<s:else>
  				 (普通会员)<a href="pay.jsp" target="frame_content">升级为VIP</a> 
  			</s:else>
  			  <a href="loginAction!exit.action " class="STYLE5">退出</a> |  
  			
  			
  			 <a href="loginAction!login.action"  class="STYLE5">我的易彩通</a> 
  			 &nbsp;<img src="images/gg1.jpg" width="16" height="14" style="vertical-align: middle;" /> 
  			 <a href="javascript:showSysMsg();"  class="STYLE5">消息(${request.sysMsgCnt})</a>
  			
  		</s:if>
  		<s:else>
  			 <a href="loginAction!toLoginPage.action" class="STYLE5">登录 |</a> 
  			 <a href="userRegister!doForwordRegPage.action" class="STYLE5">免费注册 |</a> 
  			 <a href="indexAction!notLoginIndex.action" class="STYLE5">首页</a> 
  		</s:else>
  		</li>
  		 <li>| 在线服务 | <a href="comment!lisComment.action?typeId=4" class="STYLE5">帮助中心</a> |</li> 
  		 <li class="menu2" style="text-align: left;"  onMouseOver="this.className='menu1'" onMouseOut="this.className='menu2'"><a class="STYLE5">网站导航</a> 
  		 <div class="list">
			<div class="item_div" style=""><a href="javascript:changeContent2(0, 1);">险种推荐</a></div>
			<div class="item_div"><a href="javascript:changeContent2(0, 2);" >邀请函</a></div>
			<div class="item_div"><a href="javascript:changeContent2(0, 3);"  >经典案例</a></div>
			<div class="item_div2"><a href="javascript:changeContent2(0, 5);" >保险教育</a></div>
			<div class="item_div2">
				<a href="javascript:changeContent2(1, 25);"  style="color: gray;">保险新闻</a>&nbsp;&nbsp;
				<a href="javascript:changeContent2(1, 26);"  style="color: gray;">保险意义</a> &nbsp;&nbsp;
			</div>
			<div class="item_div">
				<a href="javascript:changeContent2(1, 27);"  style="color: gray;">理财规划</a>&nbsp;&nbsp;
				<a href="javascript:changeContent2(1, 28);"   style="color: gray;">保险理论</a> &nbsp;&nbsp;
			</div>
			<div class="item_div"><a href="javascript:changeContent2(0,6);" >公告通知</a></div>
			<div class="item_div"><a href="javascript:changeContent2(0, 8);" >客户关怀</a></div>
			<div class="item_div2"><a href="about.jsp" target="">关于易彩通</a></div>
			<div class="item_div2">
				<a href="cpyc.jsp"   style="color: gray;">诚聘英才</a>&nbsp;&nbsp;
				<a href="lianxi.jsp"   style="color: gray;">联系我们</a> &nbsp;&nbsp;
			</div>
			<div class="item_div">
				<a href="comment!lisComment.action?typeId=1"  style="color: gray;">用户评价</a>&nbsp;&nbsp;
				<a href="comment!lisComment.action?typeId=2"  style="color: gray;">媒体报道</a> &nbsp;&nbsp;
			</div>
			<div class="item_div2"><a href="wzdt.jsp" >更多内容</a></div>
		</div>
		</li>
	 </ul>
  	</div>
  	
  </div>
</div>
<div id="top2">
<s:form name="sefrm" action="indexAction!findByTypeAndGroup.action" id="sefrm" method="post" target="frame_content">
  <table width="960" border="0" align="center" cellpadding="0" cellspacing="0">
    <tr>
      <td width="436" height="35">&nbsp;</td>
      <td width="148" class="top_lm">咨询热线：<strong class="top_lm">400-000-000</strong></td>
      <td width="138"> 
      <s:select list="listType" listKey="id" listValue="name"  headerKey="0" headerValue="----全部----" id="msgTypeId" name="typeId">
         </s:select></td>
      <td width="180"><input name="likeName" type="text" size="25" id="likeName" value="${likeName}"/></td>
      <td width="58"><a href="javaScript:searchMsg();"><img src="images/search.jpg" width="49" height="20" border="0" /></a></td>
    </tr>
  </table>
  </s:form>
</div>



